/**
 * Created by wm123 on 2017/6/28.
 */
const Dispatcher = require('./dispatcher');

class Messages extends Dispatcher {
    constructor() {
        super();
        this.messages = [];
        this.template = [];
        this.got = false;
    }
    append(message) {
        if (this.got) {
            this.messages.concat(this.template);
            this.template = [];
            this.got = false;
        }
        this.template.push(message);
    }
    get last() {
        this.got = true;
        return this.template;
    }
    get data() {
        return [...this.messages];
    }
}

module.exports = Messages;
